package com.ahmedmisbah.andgenplus.utils.android;

import java.io.File;

import com.ahmedmisbah.andgenplus.codegenerator.exceptions.CodeGeneratorException;
import com.ahmedmisbah.andgenplus.constants.GlobalConstants;
import com.ahmedmisbah.andgenplus.utils.file.FileUtil;
import com.ahmedmisbah.andgenplus.utils.pde.PDEUtil;

public class AndroidUtil {
	
	public static String getAndroidResourceFolderPath()
	{
		return PDEUtil.getEclipseProject().getLocation().toString()
				+ File.separator + GlobalConstants.RES_FOLDER_NAME + File.separator;
	}
	
	public static  void generateAndroidFile(String resourcePath,
			String resourceFolder, String resourceFileName, String fileContent)
			throws CodeGeneratorException {

		try {

			String filePath = resourcePath + resourceFolder + File.separator
					+ resourceFileName;

			FileUtil.writeFileAsUTF8(fileContent, filePath);

		} catch (Exception e) {
			throw new CodeGeneratorException(e);
		}

	}

}
